package top.mayyd.customerdemo.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import top.mayyd.productservice.domain.User;

@Component
public class UserDao {
    @Autowired
    private RestTemplate restTemplate;

    public User queryUserById(Long id) {
        String url = "http://localhost:8080/user/" + id;
        User user = this.restTemplate.getForObject(url, User.class);
        return user;
    }
}
